<?php

$username = isset($_SESSION["username"]);
if ($username) {
    $username = strtoupper($_SESSION["username"]);
    $logoutMessage = urlencode("by user");
    echo "
                <div id=\"login-container\">
                    User ID: $username
                    <a href=\"logout.php?logoutMessage=$logoutMessage\">Logout</a>
                </div>
                ";
} else {
    echo "
                <div id=\"login-container\">
                    <a href=\"login.php\">Login</a>
                </div>
                ";
}
?>